<?php
declare (strict_types=1);

namespace app\validate;

use think\Validate;

class UserValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'mobile' => 'require|mobile',
        'password' => 'require|length:6,14',
        //'invite_code' => 'require',
        'paint_code' => 'require'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'mobile.require' => '手机号不能为空',
        'mobile.mobile' => '手机号格式错误',
        'password.require' => '密码不能为空',
        'password.length' => '密码长度在6-14位',
        //'invite_code.require' => '邀请码不能为空',
        'paint_code.require' => '请输入店号',
    ];

    protected $scene = [
        'register' => ['mobile', 'password', 'invite_code'],
        'login' => ['mobile', 'password'],
    ];
}
